﻿using System;
using Rodunu.Movies.Services.Models.Netflix.Attributes;

namespace Rodunu.Movies.Services.Models.Netflix
{
    public class AtHomeItem : Item
    {
        public DateTime? Updated { get; set; }

        public DateTime? ShippedDate { get; set; }

        public DateTime? EsitmatedArrivaleDate { get; set; }

        [XPath("/at_home_item/updated/text()")]
        public int UpdatedX
        {
            set
            {
                Updated = new DateTime(1970, 1, 1).AddSeconds(value);
            }
        }

        [XPath("/at_home_item/shipped_date/text()")]
        public int ShippedDateX
        {
            set
            {
                ShippedDate = new DateTime(1970, 1, 1).AddSeconds(value);
            }
        }

        [XPath("/at_home_item/estimated_arrival_date/text()")]
        public int EsitmatedArrivaleDateX
        {
            set
            {
                EsitmatedArrivaleDate = new DateTime(1970, 1, 1).AddSeconds(value);
            }
        }

        [XPath("/at_home_item/link[@rel='http://schemas.netflix.com/catalog/title']")]
        public Link TitleLink { get; set; }

        public override string TitleRef
        {
            get { return TitleLink.Href; }
        }
    }
}
